import { IVec2, _decorator } from 'cc';
import { EntityManager } from '../../Base/EntityManager';
import { EntityTypeEnum, IBullet } from '../../Common';
import { EntityStateEnum, EventEnum } from '../../Enum';
import EventManager from '../../Global/EventManager';
import { BulletStateMachine } from '../Bullet/BulletStateMachine';
import { ExplosionStateMachine } from './ExplosionStateMachine';
const { ccclass } = _decorator;

// 子弹控制模块
@ccclass('ExplosionManager')
export class ExplosionManager extends EntityManager {
  // 子弹类型
  type: EntityTypeEnum;

  // 初始化
  init(type: EntityTypeEnum, { x, y }: IVec2) {
    this.node.setPosition(x, y);
    this.type = type;
    this.fsm = this.addComponent(ExplosionStateMachine);
    this.fsm.init(type);

    this.state = EntityStateEnum.Idle;
  }
}
